import { http } from "@/utils/http";
import { baseUrlApi } from "./utils";

export default {
  goodTypeList: () => {
    //商品类型列表
    return http.request<any>("get", baseUrlApi("/good-type"));
  },
  goodTypeCreate: data => {
    //新建商品类型
    return http.request<any>("post", baseUrlApi("/good-type"), { data });
  },
  goodTypeDelete: data => {
    //删除商品类型
    return http.request<any>("delete", baseUrlApi("/good-type"), { data });
  },
  specPage: params => {
    //规格类型分页列表
    return http.request<any>("get", baseUrlApi("/spec"), { params });
  },
  specList: params => {
    //规格类型列表
    return http.request<any>("get", baseUrlApi("/spec/list"), { params });
  },
  specCreate: data => {
    //新建规格类型
    return http.request<any>("post", baseUrlApi("/spec"), { data });
  },
  specDelete: data => {
    //删除规格
    return http.request<any>("delete", baseUrlApi("/spec"), { data });
  },
  specValueList: params => {
    //规格值列表
    return http.request<any>("get", baseUrlApi("/spec-value"), { params });
  },
  specValueCreate: data => {
    //新建规格值
    return http.request<any>("post", baseUrlApi("/spec-value"), { data });
  },
  specValueDelete: data => {
    //删除规格值
    return http.request<any>("delete", baseUrlApi("/spec-value"), { data });
  },
  specValueUpdate: data => {
    //修改规格值
    return http.request<any>("put", baseUrlApi("/spec-value"), { data });
  },
  goodPage: params => {
    //商品列表
    return http.request<any>("get", baseUrlApi("/good"), { params });
  },
  goodCreate: data => {
    //商品新增
    return http.request<any>("post", baseUrlApi("/good"), { data });
  },
  goodDelete: data => {
    //商品删除
    return http.request<any>("delete", baseUrlApi("/good"), { data });
  },
  goodOne: (id: number) => {
    //商品查询
    return http.request<any>("get", baseUrlApi(`/good/${id}`));
  },
  goodUpdate: data => {
    //商品更新
    return http.request<any>("put", baseUrlApi(`/good`), { data });
  }
};
